package com.topisv.tms.utils.redis;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.topisv.tms.entity.EdiOrder;
import com.topisv.tms.service.redis.RedisEdiOrdenoService;

public class SaveEdiOrdenoRedis {
	private static final Logger log = LoggerFactory.getLogger(SaveEdiOrdenoRedis.class);

	/**
	 * 将订单源数据存入redis缓存
	 * @param redisEdiOrdenoService
	 * @param ediOrders
	 */
	public static void saveRedis(RedisEdiOrdenoService redisEdiOrdenoService,EdiOrder ediOrders){
		try {
			if("ok".equals(ediOrders.getOrderStatus())){
				  Long start=System.currentTimeMillis();
			     log.info("订单号："+ediOrders.getOrdeno()+"--开始存入redis缓存");
				 redisEdiOrdenoService.save(ediOrders);//将订单数据加入到缓存
				 log.info("订单号："+ediOrders.getOrdeno()+"--存入redis缓存成功");
				 log.info("存入执行时间:"+(System.currentTimeMillis()-start)/1000.0);
			 }
		} catch (Exception e) {
			
			log.error("存入redis缓存失败", e);
		}
	}
}
